<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">

<head th:replace="top::html" />
<link rel="stylesheet" href="/bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css" />

<body class="fixed hold-transition skin-blue">
	<div class="wrapper">
		<!-- Main Header -->
		<div th:replace="tophtml::html"></div>
		<div th:replace="left::html"></div>
		<div class="content-wrapper">
			<section class="content-header">
				<div class="audit_k">
					项目详细信息&nbsp;&nbsp;&nbsp;
					<a href="javascript:void(0);selectAnchor('anchor2');" onclick="document.getElementById('anchor2').scrollIntoView()" >持有人信息</a>&nbsp;&nbsp;&nbsp;
					<a href="javascript:void(0);selectAnchor('anchor4');" onclick="document.getElementById('anchor4').scrollIntoView()" >关联的客户信息</a>&nbsp;&nbsp;&nbsp;
					<a href="javascript:void(0);selectAnchor('anchor3');" onclick="document.getElementById('anchor3').scrollIntoView()" >项目匹配信息</a>&nbsp;&nbsp;&nbsp;
					<a th:if="${not #strings.isEmpty(param.demandId)} and ${#lists.isEmpty(buttDetailList)}" id="matchData" href="javascript:void(0)">
						<input type="hidden" th:value="'demandId='+${demand.pid}+'&demandNumber='+${demand.demandNumber}+'&demandName='+${demand.demandName}+'&projectId='+${project.pid}+'&projectNumber='+${project.projectNumber}+'&projectName='+${project.projectName}">匹配该需求
					</a>
				</div> 
				<ol class="breadcrumb">
					<li><a th:href="@{/index}"><i class="fa fa-dashboard"></i>用户中心</a></li>
					<li><a th:href="@{/project/showQuery}"><i class="fa fa-dashboard"></i>项目管理</a></li>
					<li><a th:href="@{'/project/showDetail?projectId='+${project.pid}}">项目详情</a></li>
				</ol>
			</section>
			<section class="content container-fluid">
				<table id="details" class="table table-bordered">
					<tbody th:object="${project}">
						<tr>
							<td>项目名称：</td>
							<td th:text="*{not #strings.isEmpty(projectName)} and *{#strings.length(projectName)} > 50 ? *{#strings.substring(projectName, 0, 50)}+'...' : *{projectName}" 
	                            th:title="*{projectName}">xxxxx</td>
							<td>项目简介：</td>
							<td th:text="*{not #strings.isEmpty(introduction)} and *{#strings.length(introduction)} > 40 ? *{#strings.substring(introduction, 0, 40)}+'...' : *{introduction}" 
	                            th:title="*{introduction}">xxxxx</td>
						</tr>
						<tr>
							<td>项目关键字：</td>
							<td th:text="*{keyWords}">xxxxx</td>
							<td>项目持有人：</td>
							<td th:text="*{projectHolder}">xxxxx</td>
						</tr>
						<tr>
							<td>项目状态：</td>
							<td th:text="*{projectStatusWorth}">xxxxx</td>
							<td>项目来源：</td>
							<td th:text="*{sourceWorth}">xxxxx</td>
						</tr>
						<tr>
							<td>项目需求类型：</td>
							<td th:text="*{projectType}">xxxxx</td>
							<td>所属领域：</td>
							<td th:text="*{researchField}">xxxxx</td>
						</tr>
						<tr>
							<td>来源备注：</td>
							<td th:text="*{sourceRemark}">xxxxx</td>
							<td>技术成熟程度：</td>
							<td th:text="${project.technicalWorth}">xxxxx</td>
						</tr>
						<tr>
							<td>国内国外：</td>
							<td th:text="*{domesticOrForeign == 0 ? '国内' : '国外'}">xxxxx</td>
							<td>地区：</td>
							<td th:text="*{areaWorth}">xxxxx</td>
						</tr>
						<tr>
							<td>项目需求： </td>
							<td th:text="${projectAttr.projectRequirements}">xxxxx</td>
							<td>市场前景：</td>
							<td th:with="pm=${projectAttr.marketProspect}" th:text="${not #strings.isEmpty(pm)} and ${#strings.length(pm)} > 40 ? ${#strings.substring(pm, 0, 40)}+'...' : ${pm}" 
	                            th:title="${pm}">xxxxx</td>
						</tr>
						<tr>
	                        <td>备注1：</td>
	                        <td th:text="*{remark1}">xxxxx</td>
	                        <td>备注2：</td>
	                        <td th:text="*{remark2}">xxx</td>
	                    </tr>
						<tr>
	                        <td>附件：</td>
	                        <td colspan="3">
	                        	<a th:href="@{/project/downAnnex(fileName=*{annex})}" th:text="*{annex}" title="下载附件"></a>
	                        </td>
	                    </tr>
						<tr>
	                        <td>录入人：</td>
	                        <td th:text="${collectPersonName}">xxxxx</td>
	                        <td>录入时间：</td>
	                        <td th:text="*{entryTime}">xxx</td>
	                    </tr>

					</tbody>
				</table>
					    <table class="table table-bordered" >
						<tr>
						<td style="text-align: center;font-size: 16px;" colspan="12">
							<b>项目联系人</b>
							<b><a th:with="url=@{/project/showDetail(projectId=${project.pid},lookExpert=1,expertId=${person.pid})}" th:href="'javascript:lookExpert(\''+${url}+'\')'">查看联系方式</a></b>
							<input id="lookExpertPwd" type="text" placeholder="输入密码后查看">
						</td>
						</tr>
						<tr th:with="isShow=${isLook}==1 and ${isSign}==0">
							<td><label>姓名：</label></td>
							<td th:text="${person.name}" ></td>
							<td><label>手机：</label></td>
							<td th:with="len=${#strings.isEmpty(person.tell)} ? 0 : ${#strings.length(person.tell)}" th:text="${not isShow} and ${len}>4 ? ${#strings.substring(person.tell, 0, len/2-2)}+'****'+${#strings.substring(person.tell, len/2+2, len)} : ${person.tell}"></td>
							<td><label>邮箱：</label></td>
							<td th:text="${not isShow} and ${not #strings.isEmpty(person.email)} and ${#strings.length(person.email)}>4 ? '****'+${#strings.substring(person.email, 4, #strings.length(person.email))} : ${person.email}"></td>
							<td><label>微信：</label></td>
							<td th:text="${not isShow} and ${not #strings.isEmpty(person.wechat)} and ${#strings.length(person.wechat)}>3 ? '***'+${#strings.substring(person.wechat, 3, #strings.length(person.wechat))} : ${person.wechat}"></td>
							<td><label>固定电话：</label></td>
							<td th:with="len=${#strings.isEmpty(person.fixedPhone)} ? 0 : ${#strings.length(person.fixedPhone)}" th:text="${not isShow} and ${len}>4 ? ${#strings.substring(person.fixedPhone, 0, len/2-2)}+'****'+${#strings.substring(person.fixedPhone, len/2+2, len)} : ${person.fixedPhone}"></td>
							<td><label>其他联系方式：</label></td>
							<td th:text="${not isShow} and ${not #strings.isEmpty(person.otherContact)} and ${#strings.length(person.otherContact)}>3 ? '***'+${#strings.substring(person.otherContact, 3, #strings.length(person.otherContact))} : ${person.otherContact}"></td>
						</tr>
				</table>
					<!-- <tbody th:object="${person}" class="contact-hide">
						<tr>
							<td><label>专家ID：</label></td>
							<td th:text="'E'+*{expertNumber}"></td>
							<td><label>教育背景：</label></td>
							<td th:text="*{education}"></td>
						</tr>
						<tr>
							<td><label>性别：</label></td>
							<td th:text="${sex == null ? '' : sex == 0 ? '男' : '女'}">男</td>
							<td><label>出生日期：</label></td>
							<td th:text="*{birth}"></td>
						</tr>
						<tr>
							<td><label>籍贯：</label></td>
							<td th:text="*{birthPlace}"></td>
							<td><label>最高学历：</label></td>
							<td th:text="*{maxEducation}"></td>
						</tr>
						<tr>
							<td><label>专家来源：</label></td>
							<td th:text="*{sourceWorth}"></td>
							<td><label>所属领域：</label></td>
							<td th:text="*{researchField}"></td>
						</tr>
						<tr>
							<td><label>毕业院校及所学专业：</label></td>
							<td th:text="*{schoolAndMajor}"></td>
							<td><label>单位：</label></td>
							<td th:text="*{unit}"></td>
						</tr>
						<tr>
							<td><label>职务(职称)：</label></td>
							<td th:text="*{title}"></td>
							<td><label>专业领域：</label></td>
							<td th:text="*{professionaField}"></td>
						</tr>
						<tr>
							<td><label>工作经历：</label></td>
							<td th:text="*{workExp}"></td>
							<td><label>荣誉奖励：</label></td>
							<td th:text="*{honorAward}"></td>
						</tr>
						<tr>
							<td><label>科技成果：</label></td>
							<td th:text="*{technica}"></td>
							<td><label>专家类型：</label></td>
							<td th:text="*{typeWorth}"></td>
						</tr>
						<tr>
							<td><label>国内国外：</label></td>
							<td th:text="*{domesticOrForeign == 0 ? '国内' : '国外'}"></td>
							<td><label>所在地区：</label></td>
							<td th:text="*{areaWorth}"></td>
						</tr>
						<tr>
							<td><label>人才级别：</label></td>
							<td th:text="*{talentLevel}"></td>
							<td><label>附件：</label></td>
							<td><a th:if="${annex}"
								th:href="@{'/person/downloadPerson?fileName='+${annex}}">专家附件</a>
							</td>
						</tr>
						<tr>
							<td><label>备注1：</label></td>
							<td th:text="*{remark1}"></td>
							<td><label>备注2：</label></td>
							<td th:text="*{remark2}"></td>
						</tr>
					</tbody>
					<tr>
						<td colspan="4" style="text-align: center;"><input type="button" id="more" value="更多信息"/></td>
					</tr> -->
				
				<div th:if="${holderList}">
					<div class="menuTitle2 activeTitle2">
						<span id="anchor2">
							<a style="color:black;font-size: 14px; font-weight: bolder;" >持有人信息</a>
						</span>
					</div>
					<div class="menuContent2">
						<div class="outside_t" style="margin: 10px 0 0 0;"></div>
						<table class="table table-bordered">
							<tbody>
								<tr>
									<th>持有人id</th>
									<th>姓名</th>
									<th>专业领域</th>
									<th>操作</th>
								</tr>
								<tr th:each="person : ${holderList}">
									<td>
										<a th:if="${person.expertNumber}" th:href="@{'/person/personDetails?pid='+${person.pid}}" th:text="'E'+${person.expertNumber}"></a>
									</td>
									<td th:text="${person.name}">姓名</td>
									<td th:text="${person.professionaField}"></td>
									<td>
                                        <a th:href="@{'/project/showUpdateHolder?projectId=' + ${project.pid} + '&holderName=' + ${person.name} + '&personId='+${person.pid == null ? '' : person.pid}}">修改</a>
                                        <a th:href="@{'/project/showAddHolder?projectId='+${project.pid}}">添加持有人</a>
                                        <a th:href="@{'/project/deleteHolder?projectId=' + ${project.pid} + '&holderName=' + ${person.name} + '&personId='+${person.pid == null ? '' : person.pid}}">删除持有人</a>
                                    </td>
								</tr>
							</tbody>
						</table>
					</div>
				</div>
				<div th:if="${holderList}">
					<div class="menuTitle2 activeTitle2">
						<span id="anchor4"><a id="anchor4" style="color:black;font-size: 14px; font-weight: bolder;" >关联的客户信息</a></span>
					</div>
					<div class="menuContent2">
						<div class="outside_t" style="margin: 10px 0 0 0;"></div>
						<table class="table table-bordered">
							<tbody>
								<tr>
									<th>客户ID</th>
									<th>客户名称</th>
									<th>主要需求</th>
									<th>当前合作状态</th>
								</tr>
								<tr th:each="cus : ${customerList}">
									<td>
										<a th:if="${cus.customerNumber}" th:href="@{/customer/showDetail(customerId=${cus.pid})}" th:text="'C'+${cus.customerNumber}"></a>
									</td>
									<td th:text="${cus.customerName}">姓名</td>
									<td th:text="${#strings.length(cus.majorNeeds)} > 20 ? ${#strings.substring(cus.majorNeeds, 0, 20)}+'...' : ${cus.majorNeeds}" th:title="${cus.majorNeeds}"></td>
									<td th:text="${cus.currentStateName}"></td>
								</tr>
							</tbody>
						</table>
					</div>
				</div>
				<div>
					<div class="menuTitle2">
						<span id="anchor3"><a style="color:black;font-size: 14px; font-weight: bolder;"id="anchor3">项目匹配信息</a></span>
					</div>
					<div class="menuContent2">
						<div class="outside_t" style="margin: 10px 0 0 0;"></div>
						<div>
							<div class="nav-tabs-custom">
								<ul class="nav nav-tabs">
									<li class="active">
										<a href="#tab_1" data-toggle="tab" aria-expanded="true">
											<font style="vertical-align: inherit;">查看项目已匹配需求</font>
										</a>
									</li>
									<li class="">
										<a href="#tab_2" data-toggle="tab" aria-expanded="false">
											<font style="vertical-align: inherit;">查看项目未匹配需求</font>
										</a>
									</li>
									<li><button id="matching" class="btn btn-primary">匹配</button></li>
								</ul>
								<div class="tab-content">
									<div class="tab-pane active" id="tab_1">
										<table id="buttDemand" class="table table-bordered">
											<thead>
												<tr>
													<th>对接介绍</th>
													<th>负责人</th>
													<th>对接时间</th>
													<th>对接状态</th>
													<th>对接详情</th>
													<th>对接附件</th>
													<th>操作</th>
												</tr>
											</thead>
										</table>
									</div>
									<div class="tab-pane" id="tab_2">
										<table id="notButtDemand" class="table table-bordered" style="width: 100%">
											<thead>
												<tr>
													<th><input id="all" type="checkbox"></th>
													<th>需求id</th>
													<th>需求名称</th>
													<th>需求类型</th>
													<th>需求状态</th>
													<th>匹配</th>
												</tr>
											</thead>
										</table>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</section>
			<a href="#0" class="cd-top cd-is-visible">Top</a>
			<div class="box-footer">
				<a class="btn btn-primary" th:href="@{'/demand/showProjectMatchedDemand?pid='+${project.pid}}" title="项目匹配需求">匹配</a>
				<a class="btn btn-primary" th:unless="${person}" th:href="@{'/project/showAddContact?projectId='+${project.pid}}">添加联系人</a>
				<a class="btn btn-primary" th:href="@{'/project/showHolders?projectId='+${project.pid}}">持有人管理</a>
				<a class="btn btn-primary" th:href="@{'/project/showUpdate?projectId='+${project.pid}}">修改</a>
				<a class="btn btn-primary" href="javascirpt:void(0)" th:onclick="'javascript:subscribe(\''+${project.pid}+'\',1)'">关注</a>
				<button type="button" class="btn btn-primary" onclick="window.history.go(-1)">返回</button>
			</div>
		</div>
	</div>
	<input id="projectInfo" type="hidden" th:value="'&projectId='+${project.pid}+'&projectNumber='+${project.projectNumber}+'&projectName='+${project.projectName}">
	<div th:replace="footer::html"></div>
	<div class="control-sidebar-bg"></div>
	<div th:replace="bottom::html"></div>
	<script src="/bower_components/datatables.net/js/jquery.dataTables.min.js"></script>
	<script src="/bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
	<script type="text/javascript" th:inline="javascript">
		$(function() {
			var table = $("#buttDemand").DataTable({
				ajax : {
					url : [[@{/project/queryDemandButtDetail}]],
					dataSrc : "",
					data : {projectId : [[${project.pid}]]}
				},
				columns : [
					{data : "remark2"},
					{data : "buttName"},
					{data : "buttDataTime"},
					{data : "buttStatusWorth"},
					{data : "buttDetails"},
					{data : "buttaNnex",
						render : function(data, type, row, meta) {
							if (data !== null && data !== undefined) {
								return "<a href=/details/download?fileName="+data+">对接附件</a>";
							} else {
								return "";
							}
						}},
					{data : "pid", 
						render : function(data, type, row, meta) {
							return "<a href=/details/showProjectMatchDemandAddButt1?detailPid="+data+">更新对接详情</a>|<a href=/details/showProjectMatchDemandHistoryButts1?buttdetails="+data+"&pid="+[[${project.pid}]]+">查看历史详情</a>"; 
						}}
				],
				paging : false,
				searching : false,
				info : false,
				ordering : false,
				autoWidth: false
			});
			var table2 = $("#notButtDemand").DataTable({
				ajax : {
					url : [[@{/project/notButtDemand}]],
					dataSrc : "",
					data : {projectId : [[${project.pid}]]}
				},
				columns : [
					{data : "demandId",
						render : function(data, type, row, meta) {
							var demandInfo = "demandId="+data+"&demandNumber="+row.demandNumber.replace("D", "")+"&demandName="+row.demandName;
							var buttInfo = demandInfo + $("input#projectInfo").val();
							if (data !== null && data != undefined) {
								return "<input type='checkbox' class='matched' value="+buttInfo+">";
							} else {
								var ret = "<input id='"+row.demandNumber+"' disabled type='checkbox' class='matched' value="+buttInfo+">";
								return ret;
							}
						}},
					{data : "demandNumber",
						render : function(data, type, row, meta) {
							return "<a href=/demand/showDetail?demandId="+row.demandId+">"+data+"</a>";
						}},
					{data : "demandName",
						render : function(data, type, row, meta) {
							if (data.length > 20)
								return "<span title='"+data+"'>"+data.substring(0, 20)+"...</span>";
							return "<span title='"+data+"'>"+data+"</span>";
						}},
					{data : "demandType"},
					{data : "demandStatus"},
					{data : "demandId",
						render : function(data, type, row, meta) {
							if (data !== null && data != undefined) {
								return "<a href=javascript:void(0); onclick=projectMatchDemand(this)>匹配</a>";
							} else {
								return "<a href=javascript:void(0);>匹配</a>";
							}		
						}
					}
				],
				initComplete: function(settings, json) {
					$(":checkbox:disabled").closest("tr").addClass("butt-gray");
				},
				paging : false,
				searching : false,
				info : false,
				ordering : false,
				autoWidth: false
			});
		});
		$("#matching").click(function() {
			matching([[@{/demand/projectMatchDemand}]]);
		});
		function projectMatchDemand(tag) {
	        $(tag).closest("tr").find(":checkbox").prop("checked", true);
			matching([[@{/demand/projectMatchDemand}]]);
        	$(tag).removeAttr("onclick");
        }
		$("#matchData").one("click", function() {
        	var data = $(this).find("input").val();
        	matchWithData([[@{/project/demandMatchProject}]], data);
        });
	</script>
</body>

</html>